home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d7 / dial20.arc / DIAL.BAS next >
BASIC Source File  |  1988-11-06  |  20KB  |  648 lines

  1. '****************************************************************************
  2. '* 11/1/88                                                          VER 2.0 *
  3. '*                 ***  DIAL DOS LINE PHONE DIALER  ****                    *
  4. '*                              Written in                                  *
  5. '*                             QUICKBASIC 4.0                               *
  6. '*                                                                          *
  7. '* (c) 1988 by DAVID WESSON, PhD.  238 S. Quaker La. W.Hartford, CT 06119   *
  8. '****************************************************************************
  9. '
  10. ' $INCLUDE: 'dial.dec'
  11. '
  12. '========================== MAIN PROGRAM STARTS HERE ========================
  13.      initialize
  14.      header
  15.      readcommandline
  16.      goodbye
  17. '======================= DECLARED SUBROUTINES START HERE ====================
  18.  
  19. SUB addnames
  20.      PRINT "ADDING names and phone numbers to Directory."
  21.      getnames
  22.      sortdatafile
  23.      writedatafile
  24. END SUB
  25.  
  26. SUB checkdatafile
  27.  
  28. Check.for.datafile:
  29.      datafile = FREEFILE
  30.      OPEN datafile$ FOR RANDOM AS datafile
  31.      IF LOF(datafile) = 0 THEN
  32.           CLOSE datafile
  33.           KILL datafile$
  34.           makedir
  35.           CLS
  36.      END IF
  37.      CLOSE datafile
  38.       
  39. Check.for.prefix:
  40.         opendatafile
  41.         LINE INPUT #datafile, top$
  42.         IF INSTR(top$, quote$) = 0 THEN
  43.                 DIM datalines$(max)
  44.                 top$ = top$ + comma$ + quote$ + prefix$ + quote$
  45.                 WHILE NOT EOF(datafile)
  46.                         x = x + 1
  47.                         LINE INPUT #datafile, datalines$(x)
  48.                 WEND
  49.                 CLOSE datafile
  50.                 KILL datafile$
  51.                 OPEN datafile$ FOR OUTPUT AS datafile
  52.                 PRINT #datafile, top$
  53.                 FOR n = 1 TO x
  54.                         PRINT #datafile, datalines$(n)
  55.                 NEXT n
  56.         END IF
  57.         CLOSE datafile
  58.    
  59. Check.for.portdata:
  60.      readdatafile
  61.      IF LEN(port$) = 1 THEN port$ = "COM" + port$ + ":"
  62.      IF LEN(port$) + LEN(tone$) <> 6 THEN
  63.                PRINT "ERROR: Error in top line of DIAL.DAT file. Hit any key for instructions."
  64.                getkey
  65.                helpscreen
  66.      END IF
  67. END SUB
  68.  
  69. SUB checkkeyboard
  70.         keyhit = 0
  71.         in$ = INKEY$
  72.         IF in$ <> "" THEN keyhit = 1
  73.         clock
  74. END SUB
  75.  
  76. SUB clock
  77.         fixtime
  78.         row = CSRLIN
  79.         col = POS(0)
  80.         LOCATE 1, 40: PRINT newtime$
  81.         LOCATE row, col
  82. END SUB
  83.  
  84. SUB deletename
  85.      PRINT "DELETING names from Directory."
  86.    DO
  87.      found = 0
  88.      PRINT ""
  89.         INPUT "Enter FULL NAME, or Blank to EXIT : ", name$
  90.         IF name$ = "" OR name$ = esc$ THEN EXIT DO
  91.         name$ = UCASE$(name$)
  92.         FOR x = 1 TO n
  93.                 IF name$(x) = name$ THEN found = 1
  94.                 name$(x) = name$(x + found)
  95.                 number$(x) = number$(x + found)
  96.         NEXT x
  97.         n = n - found
  98.         IF found = 0 THEN
  99.                 PRINT "No listing by that name in Directory."
  100.                 PRINT "     Hit D to view Directory,"
  101.                 PRINT "         A to try Again or"
  102.                 PRINT "         any other key to EXIT."
  103.                 getkey
  104.                 SELECT CASE in$
  105.                         CASE "D"
  106.                                 showdir
  107.                         CASE "A"
  108.                                 donothing
  109.                         CASE ELSE
  110.                                 EXIT DO
  111.                 END SELECT
  112.         END IF
  113.    LOOP
  114.    writedatafile
  115.    PRINT ""
  116.    PRINT "Modifying DIAL.DAT. Type DIAL DIR to view Directory."
  117. END SUB
  118.  
  119. SUB demondial
  120.         demon = 1
  121.         DO
  122.                 try = try + 1
  123.                 header
  124.                 placecall
  125.         LOOP
  126. END SUB
  127.  
  128. SUB dialfromlist
  129.         openphonelist
  130.         opentempfile
  131.         add$ = ""
  132.         PRINT "Add PREFIX CODE to all numbers? ( Y / N ): ",
  133.         getkey
  134.         PRINT in$
  135.         PRINT ""
  136.         IF in$ = "Y" THEN add$ = prefix$
  137.         DO WHILE NOT EOF(phonelist)
  138.                 INPUT #phonelist, call$, dial$
  139.                 olddial$ = dial$
  140.                 dial$ = add$ + dial$
  141.                 placecall
  142.                 PRINT "Hang up phone, then"
  143.                 PRINT "Hit S to Save this number for future reference."
  144.                 PRINT "    E to Exit dialing after saving this number."
  145.                 PRINT "    Q to Quit dialing without saving this number."
  146.                 PRINT " or D to Dial next number without saving this one."
  147. askkey:
  148.                 getkey
  149.                 SELECT CASE in$
  150.                         CASE "S"
  151.                                 WRITE #tempfile, call$, olddial$
  152.                         CASE "E"
  153.                                 WRITE #tempfile, call$, olddial$
  154.                                 EXIT DO
  155.                         CASE "Q"
  156.                                 EXIT DO
  157.                         CASE "D"
  158.                                 donothing
  159.                         CASE ELSE
  160.                                 GOTO askkey
  161.                 END SELECT
  162.         LOOP
  163.         loftemp = LOF(tempfile)
  164.         CLOSE phonelist
  165.         CLOSE tempfile
  166.         IF loftemp = 0 THEN
  167.                 KILL tempfile$
  168.                 ELSE INPUT "Name for list of saved names: ", savelist$
  169.                      IF savelist$ = "" OR savelist$ = phonelist$ OR savelist$ = datafile$ THEN saved$ = "REDIAL.LST"
  170.                      NAME tempfile$ AS savelist$
  171.                      PRINT "Saving names in file called "; savelist$
  172.         END IF
  173. END SUB
  174.  
  175. SUB donothing
  176.         'this sub is a dummy
  177. END SUB
  178.  
  179. SUB editname
  180.      PRINT "EDITING names and phone numbers in Directory."
  181.      DO
  182.         found = 0
  183.         PRINT ""
  184.         row = CSRLIN
  185.         INPUT "Enter full or partial NAME, or Blank to END: ", name$
  186.         IF name$ = "" OR nam$ = esc$ THEN EXIT DO
  187.         name$ = UCASE$(name$)
  188.         FOR x = 1 TO n
  189.                 IF LEFT$(name$(x), LEN(name$)) = name$ THEN
  190.                         LOCATE row, 46: PRINT name$(x)
  191.                         found = 1
  192.                         INPUT "Enter NEW name or [Return] to leave as is  : ", newname$
  193.                         IF newname$ <> "" THEN name$(x) = UCASE$(newname$)
  194.                         INPUT "Enter NEW number or [Return] to leave as is: ", newnumber$
  195.                         IF newnumber$ <> "" THEN number$(x) = newnumber$
  196.                 END IF
  197.         NEXT x
  198.         IF found = 0 THEN
  199.                 PRINT "No listing by that name in Directory."
  200.                 PRINT "     Hit D to view Directory,"
  201.                 PRINT "         A to try Again or"
  202.                 PRINT "         any other key to EXIT."
  203.                 getkey
  204.                 SELECT CASE in$
  205.                         CASE "D"
  206.                                 showdir
  207.                         CASE "A"
  208.                                 donothing
  209.                         CASE ELSE
  210.                                 EXIT DO
  211.                 END SELECT
  212.         END IF
  213.      LOOP
  214.      sortdatafile
  215.      writedatafile
  216. END SUB
  217.  
  218. SUB fixtime
  219.      intime$ = TIME$                                     'current time changed
  220.          hour$ = MID$(intime$, 1, 2)                     'to newtime$
  221.          min$ = MID$(intime$, 4, 2)
  222.          sec$ = MID$(intime$, 7, 2)
  223.          hour = VAL(hour$)
  224.               IF hour < 12 THEN ampm$ = "am" ELSE ampm$ = "pm"
  225.               IF hour > 12 THEN hour = hour - 12
  226.          hour$ = STR$(hour)
  227.      newtime$ = hour$ + ":" + min$ + ":" + sec$ + " " + ampm$
  228. END SUB
  229.  
  230. SUB getkey
  231. in: in$ = INKEY$
  232.     IF in$ = "" THEN clock: GOTO in
  233.     in$ = UCASE$(in$)
  234. END SUB
  235.  
  236. SUB getnames
  237.      PRINT ""
  238.      PRINT "Enter names or blank line to end input."
  239.      PRINT "Enter numbers, use  - hyphens for pauses only."
  240.      DO
  241.           PRINT ""
  242.           INPUT "Enter NAME or Blank to EXIT  : ", name$
  243.           IF name$ = "" THEN EXIT DO
  244.           n = n + 1
  245.           name$(n) = UCASE$(name$)
  246.           INPUT "Enter NUMBER, use - for pause: ", number$
  247.           number$(n) = number$
  248.      LOOP
  249. END SUB
  250.  
  251. SUB goodbye
  252.      PRINT ""
  253.      CLOSE
  254.      END
  255. END SUB
  256.  
  257. SUB hangup
  258.      PRINT #port, "ATH0"
  259.      PRINT "Modem hung-up."
  260.      CLOSE port
  261. END SUB
  262.  
  263. SUB header
  264.         fixtime
  265.         CLS
  266.         COLOR 15: PRINT "DIAL"; : COLOR 7: PRINT " Command Line Phone Dialer  v2.0   "; newtime$
  267. END SUB
  268.  
  269. SUB helpscreen
  270.         PRINT "Syntax: DIAL name    full name or unique first part of name"
  271.         PRINT "          or MAKE    MAKES a Directory file. Use ONCE only."
  272.         PRINT "          or DIR     VIEW Directory of names and numbers"
  273.         PRINT "          or ADD     ADD names to Directory"
  274.         PRINT "          or DEL     DELETE a name in the Directory. Use full name."
  275.         PRINT "          or EDIT    EDIT a name or number in the Directory"
  276.         PRINT "          or @file   get names and #s from list called file"
  277.         PRINT "          or PRE     set prefix code sequence *"
  278.         PRINT "          or *number dial prefix before number"
  279.         PRINT "          or *name   dial prefix before name"
  280.         PRINT "          or number  dialing a number not in the Directory"
  281.         PRINT "                     (insert  - hyphen  for two second pause)"
  282.         PRINT ""
  283.         PRINT "NOTE: This program assumes use of the Hayes command set.";
  284.         goodbye
  285. END SUB
  286.  
  287. SUB hyphen
  288.         FOR D = 1 TO LEN(dial$)
  289.                 IF MID$(dial$, D, 1) = "-" THEN
  290.                         MID$(dial$, D, 1) = ","
  291.                 END IF
  292.         NEXT D
  293. END SUB
  294.  
  295. SUB initialize
  296.         max = 480
  297.         DIM srtn(max)
  298.         DIM name$(max)
  299.         DIM number$(max)
  300.         esc$ = CHR$(27)
  301.         quote$ = CHR$(34)
  302.         comma$ = CHR$(44)
  303.         datafile$ = "dial.dat"
  304.         tempfile$ = "dial.tmp"
  305.         logfile$ = "dial.log"
  306. END SUB
  307.  
  308. SUB logcall
  309.      PRINT ""
  310.      PRINT "When phone is answered, hit L to LOG call, "
  311.      PRINT "or else any other key to EXIT."
  312.      PRINT ""
  313.      getkey
  314.      IF in$ <> "L" THEN EXIT SUB
  315.      openlogfile
  316.      fixtime
  317.           ontime$ = newtime$
  318.           onhour = VAL(hour$)
  319.           onmin = VAL(min$)
  320.           onsec = VAL(sec$)
  321.      PRINT ""
  322.      PRINT "At end of call, hit any key to log time."
  323.      PRINT "Time: 00:00";
  324.      start = TIMER
  325.      timeout
  326.      PRINT ""
  327.      PRINT "Call to "; call$; " logged in DIAL.LOG."
  328.      PRINT #logfile, DATE$, LEFT$(call$, 12), dial$, ontime$, offtime$, tottime$
  329.      CLOSE logfile
  330. END SUB
  331.  
  332. SUB makedir
  333.      PRINT "==============================================================================="
  334.      PRINT "DIAL will not run without first preparing a Directory file called DIAL.DAT"
  335.      PRINT "Please answer at least the first three prompts. No names needed at this time."
  336.      COLOR 15
  337.      PRINT "WARNING: ";
  338.      COLOR 7
  339.      PRINT "If you proceed with this, any existing DIAL.DAT file will be replaced."
  340.      PRINT "                  Hit [Esc] to EXIT or any key to continue."
  341.      PRINT "==============================================================================="
  342.      PRINT ""
  343.      getkey
  344.      IF in$ = esc$ THEN END
  345.      PRINT ""
  346.      PRINT "Enter the port NUMBER ( if in doubt, type 1 )  : ";
  347.      getkey
  348.      port$ = "com" + in$ + ":"
  349.      PRINT port$
  350.      PRINT ""
  351.      PRINT "Enter the dialtone TYPE ( P = Pulse, T = Tone ): ";
  352.      getkey
  353.      tone$ = in$
  354.      PRINT tone$
  355.      PRINT ""
  356.      setprefix
  357.      PRINT ""
  358.      addnames
  359. END SUB
  360.  
  361. SUB opendatafile
  362.         datafile = FREEFILE
  363.         OPEN datafile$ FOR INPUT AS datafile
  364. END SUB
  365.  
  366. SUB openlogfile
  367.      logfile = FREEFILE
  368.      OPEN logfile$ FOR APPEND AS logfile
  369. END SUB
  370.  
  371. SUB openphonelist
  372.         phonelist = FREEFILE
  373.         OPEN phonelist$ FOR INPUT AS phonelist
  374. END SUB
  375.  
  376. SUB openport
  377.         port = FREEFILE
  378.         OPEN port$ FOR RANDOM AS port
  379. END SUB
  380.  
  381. SUB opentempfile
  382.         tempfile = FREEFILE
  383.         OPEN tempfile$ FOR OUTPUT AS tempfile
  384. END SUB
  385.  
  386. SUB placecall
  387.      IF demon = 1 THEN
  388.         PRINT "DEMON-DIALING your call to "; call$; ".  TRY"; try
  389.         ELSE PRINT "Your call to "; call$; " is dialing."
  390.      END IF
  391.      PRINT "Hit any key to HANG UP modem. Please wait . . ."
  392.      checkkeyboard
  393.      IF keyhit = 1 THEN goodbye
  394.      openport
  395.      PRINT #port, "AT X6 Q0 V1 D" + tone$ + dial$
  396.      DO
  397.           checkkeyboard
  398.           IF keyhit = 1 THEN GOTO getout
  399.           income = LOC(port)
  400.           IF income <> 0 THEN modem$ = INPUT$(1, #port)
  401.           SELECT CASE modem$
  402.                 CASE "B"
  403.                     hangup
  404.                     IF demon = 1 THEN EXIT SUB
  405.                     PRINT "Line busy. Hit [SpaceBar] to redial once,"
  406.                     PRINT "        or hit D to demon-dial until it connects,"
  407.                     PRINT "        or hit any other key to exit."
  408.                     getkey
  409.                     SELECT CASE in$
  410.                         CASE CHR$(32)
  411.                                 header
  412.                                 placecall
  413.                         CASE "D"
  414.                                 demondial
  415.                                 EXIT DO
  416.                         CASE ELSE
  417.                                 goodbye
  418.                     END SELECT
  419.                 CASE "R"
  420.                     EXIT DO
  421.                 CASE ELSE
  422.                     donothing
  423.           END SELECT
  424.      LOOP
  425.      PRINT "Pick up the receiver, THEN hit any key to hang up modem."
  426.      ring
  427. getout: 
  428.      hangup
  429.      logcall
  430.      IF demon = 1 THEN goodbye
  431. END SUB
  432.  
  433. SUB qsort (srtn(), mid)
  434.      DIM newname$(n), newnumber$(n), newsrtn(n)
  435.      y = 0: z = 1
  436. FOR x = 1 TO n
  437.      IF srtn(x) > mid THEN
  438.           newsrtn(n - y) = srtn(x)
  439.           newname$(n - y) = name$(x)
  440.           newnumber$(n - y) = number$(x)
  441.           y = y + 1
  442.           ELSE newsrtn(z) = srtn(x)
  443.                newname$(z) = name$(x)
  444.                newnumber$(z) = number$(x)
  445.                z = z + 1
  446.      END IF
  447. NEXT x
  448. y = y - 1
  449. z = z - 1
  450. FOR t = 1 TO n
  451.         name$(t) = newname$(t)
  452.         number$(t) = newnumber$(t)
  453.         srtn(t) = newsrtn(t)
  454. NEXT t
  455. ERASE newname$, newnumber$, newsrtn
  456.       PRINT "Total Names:"; n; TAB(20); "Sorting #";
  457.          FOR x = 1 TO y
  458.                FOR w = 1 TO z - x
  459.                         IF srtn(x) > srtn(x + w) THEN
  460.                                 SWAP srtn(x), srtn(x + w)
  461.                                 SWAP name$(x), name$(x + w)
  462.                                 SWAP number$(x), number$(x + w)
  463.                         END IF
  464.                NEXT w
  465.          LOCATE , 29: PRINT x;
  466.          NEXT x
  467.          FOR x = y + 1 TO n
  468.                FOR y = 1 TO n - x
  469.                         IF srtn(x) > srtn(x + y) THEN
  470.                                 SWAP srtn(x + y), srtn(x)
  471.                                 SWAP name$(x + y), name$(x)
  472.                                 SWAP number$(x + y), number$(x)
  473.                         END IF
  474.                NEXT y
  475.          LOCATE , 29: PRINT x;
  476.          NEXT x
  477.          PRINT ""
  478. END SUB
  479.  
  480. SUB readcommandline
  481.      inline$ = UCASE$(COMMAND$)
  482.      IF inline$ = "" THEN
  483.                 helpscreen
  484.            ELSE checkdatafile
  485.      END IF
  486.      mark$ = LEFT$(inline$, 1)
  487.      SELECT CASE inline$
  488.           CASE "MAKE"
  489.                makedir
  490.           CASE "ADD"
  491.                addnames
  492.           CASE "DEL"
  493.                deletename
  494.           CASE "DIR"
  495.                showdir
  496.           CASE "EDIT"
  497.                editname
  498.           CASE "PRE"
  499.                setprefix
  500.                writedatafile
  501.           CASE ELSE
  502.                IF mark$ = "@" THEN
  503.                         phonelist$ = MID$(inline$, 2)
  504.                         dialfromlist
  505.                END IF
  506.                IF mark$ = "*" THEN
  507.                         IF prefix$ = "" THEN setprefix
  508.                         inline$ = MID$(inline$, 2)
  509.                         add$ = prefix$
  510.                END IF
  511.                IF VAL(LEFT$(inline$, 1)) > 0 AND VAL(LEFT$(inline$, 1)) < 9 THEN
  512.                         call$ = inline$
  513.                         dial$ = add$ + inline$
  514.                         hyphen
  515.                         placecall
  516.                         goodbye
  517.                END IF
  518.                FOR x = 1 TO n
  519.                         IF LEFT$(name$(x), LEN(inline$)) = inline$ THEN
  520.                                 call$ = name$(x)
  521.                                 dial$ = add$ + number$(x)
  522.                         END IF
  523.                NEXT x
  524.                hyphen
  525.                IF call$ = "" THEN
  526.                         header
  527.                         PRINT "No listing found for "; inline$; " in the Directory."
  528.                         PRINT "Hit D to review Directory or any other key to EXIT."
  529.                         getkey
  530.                         IF in$ = "D" THEN showdir
  531.                         ELSE placecall
  532.                END IF
  533.      END SELECT
  534. END SUB
  535.  
  536. SUB readdatafile
  537.         opendatafile
  538.         INPUT #datafile, port$, tone$, prefix$
  539.         WHILE NOT EOF(datafile)
  540.                 n = n + 1
  541.                 INPUT #datafile, name$(n), number$(n)
  542.         WEND
  543.         CLOSE datafile
  544. END SUB
  545.  
  546. SUB ring
  547.      DO
  548.         FOR x = 1 TO 5
  549.                 SOUND 850, .85
  550.                 SOUND 650, .85
  551.         NEXT x
  552.         in$ = INKEY$
  553.         IF in$ <> "" THEN EXIT SUB
  554.         time1 = TIMER
  555.         DO
  556.                 time2 = TIMER
  557.                 IF INKEY$ <> "" THEN EXIT SUB
  558.         LOOP UNTIL time2 = time1 + 4
  559.      LOOP
  560. END SUB
  561.  
  562. SUB setprefix
  563.         PRINT "Enter PREFIX using - (hyphen) for 2 second pause."
  564.         INPUT "PREFIX CODE: ", prefix$
  565. END SUB
  566.  
  567. SUB showdir
  568.         DO
  569.                 header
  570.                 y = 1
  571.                 FOR w = 1 TO 2
  572.                         FOR x = 2 TO 22
  573.                                 z = z + 1
  574.                                 IF name$(z) = "" THEN EXIT DO
  575.                                 LOCATE x, y: PRINT name$(z); TAB(20 + y); number$(z)
  576.                         NEXT x
  577.                         y = 45
  578.                 NEXT w
  579.                 LOCATE 24, 20: COLOR 15: PRINT "Press any key for more names"; : COLOR 7
  580.                 getkey
  581.         LOOP
  582.         IF prefix$ <> "" THEN LOCATE 23, 45: PRINT "PREFIX CODE * = "; prefix$
  583.         LOCATE 24, 20: COLOR 15: PRINT "Press any key to EXIT directory"; : COLOR 7
  584.         getkey
  585.         CLS
  586. END SUB
  587.  
  588. SUB sortdatafile
  589.      PRINT "Preparing to sort Directory."
  590.      x = 1
  591.      FOR x = 1 TO n
  592.           srtn(x) = 1
  593.           FOR z = 1 TO 4
  594.                letter$ = MID$(name$(x), z, 1)
  595.                IF letter$ = "" OR letter$ < CHR$(65) OR letter$ > CHR$(90) THEN
  596.                     srtn(x) = srtn(x) * 100
  597.                     ELSE srtn(x) = (srtn(x) * 100) + (ASC(letter$) - 64)
  598.                END IF
  599.           NEXT z
  600.      stotal = stotal + srtn(x)
  601.      NEXT x
  602.      IF n = 0 THEN EXIT SUB
  603.      mid = stotal / n
  604.      qsort srtn(), mid
  605.      PRINT "DIAL.DAT modified. Type DIAL DIR to view Directory."
  606. END SUB
  607.  
  608. SUB timeout
  609.      DO WHILE INKEY$ = ""
  610.           clock
  611.           DO UNTIL sec >= start + 1
  612.                sec = TIMER
  613.           LOOP
  614.           start = start + 1
  615.           d1 = d1 + 1
  616.           IF d1 = 10 THEN
  617.                d2 = d2 + 1
  618.                d1 = 0
  619.           END IF
  620.           IF d2 = 6 THEN
  621.                d3 = d3 + 1
  622.                d2 = 0
  623.           END IF
  624.           IF d3 = 10 THEN
  625.                d4 = d4 + 1
  626.                d3 = 0
  627.           END IF
  628.           IF d4 = 10 THEN d4 = 0
  629.           d1$ = LTRIM$(STR$(d1)): d2$ = LTRIM$(STR$(d2))
  630.           d3$ = LTRIM$(STR$(d3)): d4$ = LTRIM$(STR$(d4)):
  631.           tottime$ = d4$ + d3$ + ":" + d2$ + d1$
  632.           LOCATE , 7: PRINT tottime$;
  633.      LOOP
  634.      fixtime
  635.      offtime$ = newtime$
  636. END SUB
  637.  
  638. SUB writedatafile
  639.         datafile = FREEFILE
  640.         OPEN datafile$ FOR OUTPUT AS datafile
  641.         WRITE #datafile, port$, tone$, prefix$
  642.         FOR x = 1 TO n
  643.                 WRITE #datafile, name$(x), number$(x)
  644.         NEXT x
  645.         CLOSE datafile
  646. END SUB
  647.  
  648.